package com.qf.test;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.daomain.Shoe;
import com.qf.daomain.User;
import com.qf.mapper.ShoeMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.InputStream;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author 10537
 * @version V1.0
 * @Date 2021/9/26 15:23
 */

public class Demo8 {
    @Test
    public void Test ()throws Exception{
        InputStream inputStream = Resources.getResourceAsStream("mybatis-config.xml");
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession = build.openSession();
        ShoeMapper mapper = sqlSession.getMapper(ShoeMapper.class);
        Shoe shoe=new Shoe();
        shoe.setBrand("耐克");
        PageHelper.startPage(1,5);
        List<Shoe> shoeList=mapper.findShoeByCondition(shoe);
        PageInfo<Shoe> pageInfo=new PageInfo<>(shoeList);
    }
}
